/**
 * Created by liebling on 2017/8/23.
 */
import $script from 'scriptjs';
import '../main';
import '../../css/parts/common.less';
import '../../css/activation/activation.less';
import '../../../public/plugins/xui/xui.1.0.0.css';
var ApiService = require('../../js/module/ApiService');
var UserService = require('../../js/module/UserService');
var HTML = require('../../../src/component/login/form2.html');
$script.ready('jqueryFile', function() {
	$script(['//cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js'],function () {
		// import avalon from 'avalon2';
		// require('lodash')
		
		//step1
		;(function () {
			$('#form1').validate({
				errorElement: "label",
				onkeyup: false,
				ignore: '.notCheck',
				errorPlacement: function (er, el) {
					$(el).removeClass("m-success-con");
					$(el).addClass("m-error-con");
					$(el).closest(".xui-item").find(".xui-wordError").append(er);
				},
				success: function (element, callblack) {
					$(element).remove();
					$(callblack).removeClass("m-error-con");
					$(callblack).addClass("m-success-con");
				},
				onfocusout: function (element) {
					$(element).valid();
				},
				rules: {
					itemNum: {
						required: true
					}
				},
				messages: {
					itemNum: {
						required: '必填',
					}
				},
				submitHandler: function () {
					$('.f-bar2').css('width','25%');
					$('.ball').eq(1).css('background-color','#d12712');
					setTimeout(function () {
						var temp = _.template(HTML);
						$('.f-formCon').replaceWith(temp({data:{}}));
					},1000);
				}
			});
		}());
		//step2
		//step3
		//step2返回step1
		//step3返回step2
	});
});

